package cn.enilu.flash.dao.transport;

import cn.enilu.flash.bean.dto.transport.MapLineDto;
import cn.enilu.flash.bean.entity.transport.MapLine;
import cn.enilu.flash.bean.entity.transport.MapPoint;
import cn.enilu.flash.dao.BaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface MapLineRepository extends BaseRepository<MapLine,Long> {


    @Query(value = "SELECT l.id,l.group_id as groupId," +
            "p.latitude as `pointList.latitude`,p.longitude as `pointList.longitude`," +
            "p.next_id as `pointList.nextId`,p.point_type as `pointList.pointType`," +
            "p.address_details as `pointList.addDetail`,p.city as `pointList.city`,p.district as `pointList.dist` " +
            "FROM t_map_line l LEFT JOIN t_map_point p ON p.road_id=l.group_id WHERE l.group_id=:roadId",nativeQuery = true)
    List<MapLine> findPointList(@Param("roadId") Long roadId);


}
